<?php
require('config.php');

        $zh=$_REQUEST['zh'];
        $pwd=$_REQUEST['pwd'];
        $time=date('Y-m-d H:i:s');
		$sql="select * from `".$oto."_users` where `userPhone`='{$zh}' and userFlag='1' LIMIT 1";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$pson[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(!isset($pson))
		{
			$data[0]['chenggong']='false';
			$data[0]['msg']='账号不存在';
		}
		else
		{
			$sql="select * from `".$oto."_users` where `userPhone`='{$zh}' and loginPwd='{$pwd}' and userFlag='1' LIMIT 1";
			$result=$db->query($sql);
			while($row=$result->fetch_assoc()){
				$yan[]=$row;//将取得的所有数据赋值给person_info数组
			}
			if(!isset($yan))
			{
				$data[0]['chenggong']='-1';
				$data[0]['msg']='密码错误';
			}
			else
			{
				$userId=$pson[0]['userId'];
				$sql="update ".$oto."_users set lastTime='{$time}' where userId='{$userId}'";
				$result=$db->query($sql);
				$yan[0]['chenggong']='true';
				$yan[0]['msg']='登陆成功';
				$data=$yan;
			}
		}
		echo json_encode($data);
?>